import React, { Component } from 'react';
import '../../../styles/index/home/Activity.scss'
import { activity_list } from "../../../api/index";

class Activity extends Component {
  constructor(props) {
    super(props)
    this.state = {
      list: []
    }
  }
  async componentDidMount() {
    var res = await activity_list()
    this.setState({ list: res.data })
  }
  render() {
    return (
      <div className='activity1'>
        <p className='title'>
          活动专区
        </p>
        <div className="list">
          {
            this.state.list.map((item, index) => {
              return (
                <div className="item" key={index}>
                  <div className="left">
                    <p className="p1">{item.title}</p>
                    <p className="p2">{item.name}</p>
                    <span className="p3">立即查看</span>
                  </div>
                  <div className="right">
                    <img src={item.pic} alt="" />
                  </div>

                </div>
              )
            })
          }
        </div>
      </div>
    );
  }
}

export default Activity;